<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .wrap {
            width: 100px;
            height: 100px;
            padding: 100px;
            border: 5px solid red;
            margin: 100px auto;
            perspective: 500px;
        }

        .wrap .box {
            width: 100px;
            height: 100px;
            position: relative;
            transition: 5s;
            transform-style: preserve-3d;
        }

        .wrap .box div {
            width: 100px;
            height: 100px;
            position: absolute;
            top: 0;
            left: 0;
            font-size: 20px;
            line-height: 100px;
            text-align: center;
            background: pink;
        }

        /* 上边 */
        .wrap .box div:nth-of-type(1) {
            background: blue;
            top: -100px;
            left: 0;
            transform: rotateX(90deg);
            /* 旋转的中心点 */
            transform-origin: bottom;
        }

        /*下*/
        .wrap .box div:nth-of-type(2) {
            background: yellow;
            top: 100px;
            left: 0;
            transform: rotateX(-90deg);
            transform-origin: top;
        }

        /*后*/
        .wrap .box div:nth-of-type(3) {
            background: orangered;
            top: 0;
            left: 0;
            transform: translateZ(-100px);
        }

        /*左*/
        .wrap .box div:nth-of-type(4) {
            background: greenyellow;
            top: 0;
            left: -100px;
            transform: rotateY(-90deg);
            transform-origin: right;
        }

        /*右*/
        .wrap .box div:nth-of-type(5) {
            background: indigo;
            top: 0;
            left: 100px;
            transform-origin: left;
            transform: rotateY(90deg);
        }

        .wrap:hover .box {
            /*transform: rotateX(360deg);*/
            /* transform: rotateY(360deg); */
            transform: rotate3d(1, 1, 1, 720deg);
        }

        /* 使用动画，将3d盒子更改为一直在摇的效果 */
    </style>
</head>

<body>
    <div class="wrap">
        <div class="box">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
        </div>
    </div>
</body>

</html>